<?php
class PresentationCheckbox extends Presentation {
    public function fixInput($current, $rawInput) {
        return $rawInput ? 1 : 0;
    }
    
    public function formatFormField(&$field) {
        $field['type'] = 'checkbox';
        $field['checked'] = isset($field['value']) && $field['value'];
        $field['value'] = 1;
    }
    
    public function formatForList($value) {
        return '<input type="checkbox" disabled="" ' .
                ($value ? 'checked="" ' : '') . '/>';
    }
    
    public function getFilteringType() {
        return 'checkbox';
    }
}